<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    <h1>注册</h1>
    用户名：<input type="text" id="username">
    <br>
    密码：<input type="text" id="password">
    <br>
    <button id="reg">注册</button>
    <script src="./cookie.js"></script>
    <script>
            // 点击注册  获取输入框的值  添加到cooKie 注册成功
     var regBtn=document.querySelector("#reg"); //注册按钮
     var username=document.querySelector("#username"); //用户名的 输入框
     var password=document.querySelector("#password");//密码的输入框
     regBtn.onclick=function(){
         if(username.value&&password.value){
            //  将用户名 密码 存储到cookie
                cookieObj.setCookie("username",username.value,1)
                cookieObj.setCookie("password",password.value,1)
                alert("注册成功")
                location.href="./登录.html"
         }else{
             alert("请补全信息")
         }
     }
    </script>
</body>
</html>